import numpy as np

if __name__ == '__main__':
    matrix_random = np.arange(0, 9).reshape((3, 3))
    print(matrix_random)

    # 通过提取对角线上的元素获得对角矩阵
    matrix_diag = np.diag(matrix_random)
    print(matrix_diag)
